package zx.x.modules.yshapp.utils;

import java.util.Random;

public class InviteCodeUtil {
    private static final String CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    public static String generateInviteCode(int length) {
        StringBuilder inviteCode = new StringBuilder();
        Random random = new Random();

        for (int i = 0; i < length; i++) {
            int index = random.nextInt(CHARACTERS.length());
            inviteCode.append(CHARACTERS.charAt(index));
        }

        return inviteCode.toString();
    }

    public static void main(String[] args) {
        String inviteCode1 = generateInviteCode(8);
        String inviteCode2 = generateInviteCode(10);

        System.out.println("Invite Code 1: " + inviteCode1);
        System.out.println("Invite Code 2: " + inviteCode2);
    }
}
